close all;

%% objective
figure;
% Active
method = 1;
jmp = 43;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'color', 'cyan', 'marker', 's');
hold on;

% Boost
method = 2;
jmp = 3;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'color', 'magenta', 'marker', 'v');
hold on;

% SoftImputeALS
method = 4;
jmp = 100;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'color', 'yellow', 'marker', 'd');
hold on;

% MMBS
% method = 3;
% jmp = 5;
% 
% obj = out{method}.obj;
% obj = obj - min(obj);
% semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'color', 'red', 'marker', '>');
% hold on;

% APG
method = 7;
jmp = 10;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'color', 'blue', 'marker', 'o');
hold on;

% Soft-Impute
method = 6;
jmp = 20;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'Marker', 'x', 'color', 'green');
hold on;

% AIS-Impute
method = 5;
jmp = 10;

obj = out{method}.obj;
obj = obj - min(obj);
semilogy(out{method}.Time(1:jmp:end), obj(1:jmp:end), 'linewidth', 2, 'Marker', '+', 'color','black');
hold on;

axis([0.1, 2000, 1e-2, 1e+7]);
xlabel('time (sec)');
ylabel('objective minus best');
% legend({'Active', 'Boost', 'ALT-Impute', 'TR', 'APG', 'Soft-Impute', 'AIS-Impute'}, 'fontsize', 10);
legend({'Active', 'Boost', 'ALT-Impute', 'APG', 'Soft-Impute', 'AIS-Impute'}, 'fontsize', 10);

%% RMSE
figure;
% Active
method = 1;
jmp = 5;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'color', 'cyan', 'marker', 's');
hold on;

% Boost
method = 2;
jmp = 1;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'color', 'magenta', 'marker', 'v');
hold on;

% SoftImputeALS
method = 4;
jmp = 10;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'color', 'yellow', 'marker', 'd');
hold on;

% MMBS
% method = 3;
% jmp = 1;
% 
% plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'color', 'red', 'marker', '>');
% hold on;

% APG
method = 7;
jmp = 2;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'color', 'blue', 'marker', 'o');
hold on;

% Soft-Impute
method = 6;
jmp = 5;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'Marker', 'x', 'color', 'green');
hold on;

% AIS-Impute
method = 5;
jmp = 5;

plot(out{method}.Time(1:jmp:end), out{method}.RMSE(1:jmp:end), 'linewidth', 2, 'Marker', '+', 'color','black');
hold on;

axis([0, 100, 0.8, 4]);
xlabel('time (sec)');
ylabel('Testing RMSE');
% legend({'Active', 'Boost', 'ALT-Impute', 'TR', 'APG', 'Soft-Impute', 'AIS-Impute'}, 'fontsize', 10);
legend({'Active', 'Boost', 'ALT-Impute', 'APG', 'Soft-Impute', 'AIS-Impute'}, 'fontsize', 10);